﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;

namespace ComicsEditor
{
    public abstract class PageObject
    {
        public int Order = 0;

        protected Page page;
        protected bool visible = true;

        public PageObject(Page Page)
        {
            page = Page;
            if (Page != null)
                Page.Add(this);
        }

        public PageObject(Page Page, int Order)
        {
            this.Order = Order;

            page = Page;
            if (Page != null)
                Page.Add(this);
        }

        public virtual void Dispose()
        {
            Page.Remove(this);
        }

        public Page Page
        {
            get
            {
                return page;
            }
        }

        public bool Visible
        {
            get
            {
                return visible;
            }
        }

        public virtual void Show()
        {
            visible = true;
            Page.Changed = true;
        }

        public virtual void Hide()
        {
            visible = false;
            Page.Changed = true;
        }

        public virtual void Draw(Graphics Graphics)
        {
        }

        public virtual void Move(Point newPoint, Point deltaMove)
        {
        }

        public virtual bool Activate(Point point, out Point offset)
        {
            offset = Point.Empty;
            return false;
        }

        public virtual void Drag(Point newPoint, Point offset, Point deltaActivate, Point deltaMove)
        {
        }

        public virtual void Deactivate()
        {
        }
    }
}
